/**
 * @title ViewAdapter.java
 * @package com.esun.cheetah.view.introduce
 * @description ViewPager控件的数据适配器
 * @author liugan
 * @date 2012-4-28
 * @copyright 深圳市易讯天空
 */
package com.esun.cheetah.view.introduce;

import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;

/**
 * @title ViewAdapter
 * @description 提供介绍页显示的4个页面
 * @author liugan
 */
public class ViewAdapter extends PagerAdapter {
	/**
	 * 所有的介绍页面
	 */
	private View mViews[];

	public ViewAdapter(View[] mViews) {
		super();
		this.mViews = mViews;
	}

	@Override
	public int getCount() {
		return mViews.length;
	}

	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		((ViewPager) container).removeView(mViews[position]);
	}

	@Override
	public Object instantiateItem(ViewGroup container, int position) {
		((ViewPager) container).addView(mViews[position], 0);
		return mViews[position];
	}

	@Override
	public boolean isViewFromObject(View view, Object obj) {
		return view == obj;
	}

}
